#!/usr/bin/python3
# -* - coding: UTF-8 -* -
from selenium.webdriver.common.by import By

from BaseCase import BaseCase
from selenium_utils import AppStart
from selenium_utils.ElementGps import ElementGps
from selenium_utils.ElementOperate import ElementOperate
from utils import Support
from utils.Dec import desc, run


class university_for_old_age_case(BaseCase):

    def setUp(self):
        self.gps = ElementGps(self.driver)
        self.operate = ElementOperate(self.driver)

    @desc(desc='用例描述')
    @run
    def test_case_1(self):
        AppStart.just_open_url(self.driver, 'https://testadmin.h4edu.com/#/')
        input_user = self.gps.find_element(By.NAME, 'username')
        self.operate.input(input_user, '15611')
        self.operate.input(self.gps.find_element(By.NAME, 'password'), 'sha')
        self.operate.click(self.gps.button('登录'))

        self.operate.click(self.gps.find_element(By.XPATH, '//*[@href="#/courseArrangement/index"]'))
        self.operate.click(self.gps.button('新建排课'))
        self.operate.input(self.gps.find_element(By.XPATH, '//*[@id="pane-createCourse"]/form/div[1]/div/div[1]/input'),
                           'Test')
        self.operate.click(
            self.gps.find_element(By.XPATH, '//*[@id="pane-createCourse"]/form/div[2]/div/div/div/input'))
        self.operate.click(self.gps.find_element_match_text(By.CLASS_NAME, 'el-select-dropdown__item', '声乐'))
        Support.sleep(60)
